#pragma once
#include <iostream>
#include <pthread.h>

namespace MutexMoudle
{
    class Mutex
    {
    public:
    Mutex(const Mutex&)=delete;
    Mutex&operator=(const Mutex&)=delete;
    Mutex()
    {
        pthread_mutex_init(&_mutex,nullptr);
    }
    void Lock()
    {
        pthread_mutex_lock(&_mutex);
    }
    pthread_mutex_t* GetMutexPtr()
    {
        return &_mutex;
    }
    void Unlock()
    {
        pthread_mutex_unlock(&_mutex);
    }
    ~Mutex()
    {
        pthread_mutex_destroy(&_mutex);
    }
    private:
        pthread_mutex_t _mutex;
    };
}